﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Logistics.Win
{
    /// <summary>
    /// Interaction logic for WinSettings.xaml
    /// </summary>
    public partial class WinSettings : Window
    {
        public WinSettings()
        {
            InitializeComponent();
        }

        private void treeMenu_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            TreeViewItem node = e.NewValue as TreeViewItem;
            String tag = node.Tag as string;
            switch (tag)
            {
                case "BASESETTING":
                    ShowBaseSetting();
                    break;
                case "PRINTER":
                    ShowPrinter();
                    break;
                case "SERVERSETTING":
                    if (GlobalObjects.CurrentUser.UserID.Equals("admin") || GlobalObjects.CurrentUser.UserID.Equals("maketop"))
                    {
                        ShowServerSetting();
                    }
                    break;
                default:
                    break;
            }
        }

        private void ShowPrinter()
        {
            this.PanlePrinter.Visibility = Visibility.Visible;
            this.PanleBase.Visibility = Visibility.Hidden;
            this.PanelServer.Visibility = Visibility.Hidden;
        }
        private void ShowBaseSetting()
        {
            this.PanlePrinter.Visibility = Visibility.Hidden;
            this.PanleBase.Visibility = Visibility.Visible;
            this.PanelServer.Visibility = Visibility.Hidden;
        }
        private void ShowServerSetting()
        {
            this.PanlePrinter.Visibility = Visibility.Hidden;
            this.PanleBase.Visibility = Visibility.Hidden;
            this.PanelServer.Visibility = Visibility.Visible;
        }
    }
}
